import User.User;

import java.util.Scanner;
import User.Admin;
import User.Normal;
import book.BookList;

public class Main {
    private static User login(String name, int type){
        if(type == 1){
            return new Admin(name);
        }else {
            return new Normal(name);
        }
    }
    public static void main(String[] args) {
        BookList bookList = new BookList();
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入姓名：");
        String name = scanner.nextLine();
        System.out.println("请输入你的身份，1:管理员   2：普通用户");
        int type = scanner.nextInt();
        User user = login(name,type);
        while (true){
            user.menu();
            System.out.println("请输入你的操作：");
            int choice = scanner.nextInt();
            user.doWork(choice,bookList);
        }
    }
}